<?php

use console\services\MigrateService;
use yii\db\Migration;

/**
 * Handles the creation of table `sys_menu`.
 */
class m231229_144110_create_sys_menu_table extends Migration
{
    /**
     * {@inheritdoc}
     */
    public function safeUp()
    {
        $this->createTable('sys_menu', [
            'id' => $this->bigPrimaryKey(),
            'name' => $this->string(64)->defaultValue('')->null()->comment('菜单名称'),
            'parent_id' => $this->bigInteger()->defaultValue(0)->null()->comment('父级ID'),
            'type' => $this->char(1)->defaultValue('')->null()->comment('菜单类型（M目录 C菜单 F按钮）'),
            'perms' => $this->string(128)->defaultValue('')->null()->comment('权限标识'),
            'icon' => $this->string(64)->defaultValue('')->null()->comment('图标'),
            'url' => $this->string(255)->defaultValue('')->null()->comment('路由地址'),
            'query' => $this->string(255)->defaultValue('')->null()->comment('路由地址'),
            'component' => $this->string(255)->defaultValue('')->null()->comment('组件'),
            'is_external' => $this->char(1)->defaultValue('0')->null()->comment('是否外链'),
            'is_cache' => $this->char(1)->defaultValue('1')->null()->comment('是否缓存（0不缓存 1缓存）'),
            'is_visible' => $this->char(1)->defaultValue('1')->null()->comment('是否显示（0不显示 1显示）'),
            'status' => $this->char(1)->defaultValue('1')->null()->comment('菜单状态（1有效 0无效）'),
            'list_sort' => $this->bigInteger()->defaultValue(10)->null()->comment('顺序'),
            'remark' => $this->string(255)->defaultValue('')->null()->comment('备注'),
            'create_time' => $this->bigInteger()->defaultValue(0)->null()->comment('创建时间'),
            'update_time' => $this->bigInteger()->defaultValue(0)->null()->comment('更新时间'),
        ], MigrateService::createTableOptions('菜单表'));

        $this->batchInsert('sys_menu',
            ['id', 'name', 'parent_id', 'type', 'perms', 'icon', 'url', 'query', 'component', 'is_external', 'is_cache', 'is_visible', 'status', 'list_sort', 'remark', 'create_time', 'update_time'],
            [
                [1, '系统管理', 0, 'M', '', 'system', 'system', '', '', '0', '1', '1', '1', 1, '系统管理目录', 1732850585, 1732850585],
                [3, '系统工具', 0, 'M', '', 'tool', 'tool', '', '', '0', '1', '1', '1', 3, '系统工具目录', 1732850585, 1732850585],
                [4, '官方网站', 0, 'M', '', 'guide', 'http://www.b5net.com', '', '', '1', '1', '1', '1', 4, '若依官网地址', 1732850585, 1732850585],
                [100, '用户管理', 1, 'C', 'system:admin:list', 'user', 'admin', '', 'system/admin/index', '0', '1', '1', '1', 1, '用户管理菜单', 1732850585, 1732850585],
                [101, '角色管理', 1, 'C', 'system:role:list', 'peoples', 'role', '', 'system/role/index', '0', '1', '1', '1', 2, '角色管理菜单', 1732850585, 1732850585],
                [102, '菜单管理', 1, 'C', 'system:menu:list', 'tree-table', 'menu', '', 'system/menu/index', '0', '1', '1', '1', 3, '菜单管理菜单', 1732850585, 1732850585],
                [103, '部门管理', 1, 'C', 'system:dept:list', 'tree', 'dept', '', 'system/dept/index', '0', '1', '1', '1', 4, '部门管理菜单', 1732850585, 1732850585],
                [104, '岗位管理', 1, 'C', 'system:post:list', 'post', 'post', '', 'system/post/index', '0', '1', '1', '1', 5, '岗位管理菜单', 1732850585, 1732850585],
                [105, '字典管理', 1, 'C', 'system:dict-type:list', 'dict', 'dict', '', 'system/dict/index', '0', '1', '1', '1', 6, '字典管理菜单', 1732850585, 1732850585],
                [106, '参数设置', 1, 'C', 'system:config:list', 'edit', 'config', '', 'system/config/index', '0', '1', '1', '1', 7, '参数设置菜单', 1732850585, 1732850585],
                [107, '通知公告', 1, 'C', 'system:notice:list', 'message', 'notice', '', 'system/notice/index', '0', '1', '1', '1', 8, '通知公告菜单', 1732850585, 1732850585],
                [108, '日志管理', 1, 'M', '', 'log', 'log', '', '', '0', '1', '1', '1', 9, '日志管理菜单', 1732850585, 1732850585],
                [109, '省市地区', 1, 'C', 'system:city:list', 'MapLocation', 'city', '', 'system/city/index', '0', '1', '1', '1', 8, '省市地区菜单', 1732850585, 1732850585],
                [200, '表单构建', 3, 'C', 'tool:build:list', 'build', 'build', '', 'tool/build/index', '0', '1', '1', '1', 1, '表单构建菜单', 1732850585, 1732850585],
                [201, '系统接口', 3, 'C', 'tool:swagger:list', 'swagger', 'swagger', '', 'tool/swagger/index', '0', '1', '1', '1', 3, '系统接口菜单', 1732850585, 1732850585],
                [1081, '操作日志', 108, 'C', 'system:operate-log:list', 'form', 'operatelog', '', 'system/operate-log/index', '0', '1', '1', '1', 1, '操作日志菜单', 1732850585, 1732850585],
                [1082, '登录日志', 108, 'C', 'system:login-log:list', 'logininfor', 'logininfor', '', 'system/login-log/index', '0', '1', '1', '1', 2, '登录日志菜单', 1732850585, 1732850585],
                [10001, '用户新增', 100, 'F', 'system:admin:add', '', '', '', '', '0', '1', '1', '1', 1, '', 1732850585, 1732850585],
                [10002, '用户修改', 100, 'F', 'system:admin:edit', '', '', '', '', '0', '1', '1', '1', 2, '', 1732850585, 1732850585],
                [10003, '用户删除', 100, 'F', 'system:admin:delete', '', '', '', '', '0', '1', '1', '1', 3, '', 1732850585, 1732850585],
                [10004, '用户导出', 100, 'F', 'system:admin:export', '', '', '', '', '0', '1', '1', '1', 4, '', 1732850585, 1732850585],
                [10005, '用户导入', 100, 'F', 'system:admin:import', '', '', '', '', '0', '1', '1', '1', 5, '', 1732850585, 1732850585],
                [10006, '重置密码', 100, 'F', 'system:admin:reset-pwd', '', '', '', '', '0', '1', '1', '1', 6, '', 1732850585, 1732850585],
                [10010, '分配用户', 100, 'F', 'system:admin:auth-role', '', '', '', '', '0', '1', '1', '1', 10, '', 1732850585, 1732850585],

                [10102, '角色新增', 101, 'F', 'system:role:add', '', '', '', '', '0', '1', '1', '1', 1, '', 1732850585, 1732850585],
                [10103, '角色修改', 101, 'F', 'system:role:edit', '', '', '', '', '0', '1', '1', '1', 2, '', 1732850585, 1732850585],
                [10104, '角色删除', 101, 'F', 'system:role:delete', '', '', '', '', '0', '1', '1', '1', 3, '', 1732850585, 1732850585],
                [10105, '角色导出', 101, 'F', 'system:role:export', '', '', '', '', '0', '1', '1', '1', 4, '', 1732850585, 1732850585],
                [10106, '角色状态', 101, 'F', 'system:role:status', '', '', '', '', '0', '1', '1', '1', 5, '', 1732850585, 1732850585],
                [10112, '分配用户', 101, 'F', 'system:role:auth-list', '', '', '', '', '0', '1', '1', '1', 6, '', 1732850585, 1732850585],
                [10113, '数据权限', 101, 'F', 'system:role:data-scope', '', '', '', '', '0', '1', '1', '1', 7, '', 1732850585, 1732850585],

                [10201, '菜单新增', 102, 'F', 'system:menu:add', '', '', '', '', '0', '1', '1', '1', 1, '', 1732850585, 1732850585],
                [10202, '菜单修改', 102, 'F', 'system:menu:edit', '', '', '', '', '0', '1', '1', '1', 2, '', 1732850585, 1732850585],
                [10203, '菜单删除', 102, 'F', 'system:menu:delete', '', '', '', '', '0', '1', '1', '1', 3, '', 1732850585, 1732850585],

                [10301, '部门新增', 103, 'F', 'system:dept:add', '', '', '', '', '0', '1', '1', '1', 1, '', 1732850585, 1732850585],
                [10302, '部门修改', 103, 'F', 'system:dept:edit', '', '', '', '', '0', '1', '1', '1', 2, '', 1732850585, 1732850585],
                [10303, '部门删除', 103, 'F', 'system:dept:delete', '', '', '', '', '0', '1', '1', '1', 3, '', 1732850585, 1732850585],

                [10401, '岗位新增', 104, 'F', 'system:post:add', '', '', '', '', '0', '1', '1', '1', 1, '', 1732850585, 1732850585],
                [10402, '岗位修改', 104, 'F', 'system:post:edit', '', '', '', '', '0', '1', '1', '1', 2, '', 1732850585, 1732850585],
                [10403, '岗位删除', 104, 'F', 'system:post:delete', '', '', '', '', '0', '1', '1', '1', 3, '', 1732850585, 1732850585],
                [10404, '岗位导出', 104, 'F', 'system:post:export', '', '', '', '', '0', '1', '1', '1', 4, '', 1732850585, 1732850585],

                [10501, '字典新增', 105, 'F', 'system:dict-type:add', '', '', '', '', '0', '1', '1', '1', 1, '', 1732850585, 1732850585],
                [10502, '字典修改', 105, 'F', 'system:dict-type:edit', '', '', '', '', '0', '1', '1', '1', 2, '', 1732850585, 1732850585],
                [10503, '字典删除', 105, 'F', 'system:dict-type:delete', '', '', '', '', '0', '1', '1', '1', 3, '', 1732850585, 1732850585],
                [10504, '字典导出', 105, 'F', 'system:dict-type:export', '', '', '', '', '0', '1', '1', '1', 4, '', 1732850585, 1732850585],
                [10505, '刷新缓存', 105, 'F', 'system:dict-type:cache', '', '', '', '', '0', '1', '1', '1', 5, '', 1732850585, 1732850585],
                [10510, '数据列表', 105, 'F', 'system:dict-data:list', '', '', '', '', '0', '1', '1', '1', 10, '', 1732850585, 1732850585],
                [10511, '数据新增', 105, 'F', 'system:dict-data:add', '', '', '', '', '0', '1', '1', '1', 11, '', 1732850585, 1732850585],
                [10512, '数据编辑', 105, 'F', 'system:dict-data:edit', '', '', '', '', '0', '1', '1', '1', 12, '', 1732850585, 1732850585],
                [10513, '数据删除', 105, 'F', 'system:dict-data:delete', '', '', '', '', '0', '1', '1', '1', 13, '', 1732850585, 1732850585],

                [10601, '参数新增', 106, 'F', 'system:config:add', '', '', '', '', '0', '1', '1', '1', 1, '', 1732850585, 1732850585],
                [10602, '参数修改', 106, 'F', 'system:config:edit', '', '', '', '', '0', '1', '1', '1', 2, '', 1732850585, 1732850585],
                [10603, '参数删除', 106, 'F', 'system:config:delete', '', '', '', '', '0', '1', '1', '1', 3, '', 1732850585, 1732850585],
                [10604, '参数导出', 106, 'F', 'system:config:export', '', '', '', '', '0', '1', '1', '1', 4, '', 1732850585, 1732850585],
                [10605, '刷新缓存', 106, 'F', 'system:config:cache', '', '', '', '', '0', '1', '1', '1', 5, '', 1732850585, 1732850585],

                [10701, '公告新增', 107, 'F', 'system:notice:add', '', '', '', '', '0', '1', '1', '1', 1, '', 1732850585, 1732850585],
                [10702, '公告修改', 107, 'F', 'system:notice:edit', '', '', '', '', '0', '1', '1', '1', 2, '', 1732850585, 1732850585],
                [10703, '公告删除', 107, 'F', 'system:notice:delete', '', '', '', '', '0', '1', '1', '1', 3, '', 1732850585, 1732850585],


                [10821, '登录清空', 1082, 'F', 'system:login-log:clear', '', '', '', '', '0', '1', '1', '1', 1, '', 1732850585, 1732850585],
                [10822, '登录删除', 1082, 'F', 'system:login-log:delete', '', '', '', '', '0', '1', '1', '1', 2, '', 1732850585, 1732850585],
                [10823, '账号登出', 1082, 'F', 'system:login-log:unlock', '', '', '', '', '0', '1', '1', '1', 3, '', 1732850585, 1732850585],


                [10901, '地区新增', 109, 'F', 'system:city:add', '', '', '', '', '0', '1', '1', '1', 1, '', 1732850585, 1732850585],
                [10902, '地区修改', 109, 'F', 'system:city:edit', '', '', '', '', '0', '1', '1', '1', 2, '', 1732850585, 1732850585],
                [10903, '地区删除', 109, 'F', 'system:city:delete', '', '', '', '', '0', '1', '1', '1', 3, '', 1732850585, 1732850585],
            ]
        );
    }

    /**
     * {@inheritdoc}
     */
    public function safeDown()
    {
        $this->dropTable('sys_menu');
    }
}
